/**********************************************************
    COPYRIGHT
       LGX(c) 2011
    CLASS NAME
        platform_cpld.h
    DEPENDENCY

    HISTORY
		02/29/2012, created by Guangxing Liu
**********************************************************/
#ifndef PLATFORM_DECODE_H
#define PLATFORM_DECODE_H

#define DECODE_DEVICE           	 "DECODE"
#define DECODE_MAX_PORT_NUM 64
#define DECODE_ADC_CHANNEL_NUM 8
#define DECODE_MAX_COMMAND_STATEMENT 512
#define DECODE_MAX_STATEMENT_LENGTH 32
#define DECODE_MAX_COMMAND_INDEX 32

#define platform_decode_app_call_device_op_decodeinit    	         "0_decodeinit"
#define platform_decode_app_call_device_op_writepin   	                  "1_writepin"
#define platform_decode_app_call_device_op_readpin   	                  "2_readpin"

typedef enum{
	Platform_Decode_App_Call_None = 0,
	Platform_Decode_App_Call_Decode_Init,
	Platform_Decode_App_Call_Decode_WritePin,
	Platform_Decode_App_Call_Decode_ReadPin
	
}platform_decode_device_opt;

typedef struct _platform_decode_app_call_
{
	platform_decode_device_opt iOpt;
	
}platform_decode_app_call;

typedef enum
{
	P_NONE=0,
	P0,
	P1,
	P2,
	P3,
	P4,
	P5,
	P6,
	P7,
	P8,
	P9,
	P10,
	P11,
	P12,
	P13,
 	P14,
	P15,
	P16,
	P17,
	P18,
	P19
}PORT_NAME;

typedef enum
{
	V_NONE=0,
	V0,
	V1,
	V2,
	V3,
	V4,
	V5,
	V6,
	V7,
	V8,
	V9,
	V10,
	V11,
	V12,
	V13,
 	V14,
	V15,
	V16,
	V17,
	V18,
	V19
}VALUE_NAME;

typedef enum
{
	DECODE_FUNCTION_NONE=0,
	DECODE_GPIO,
	DECODE_PWM,
	DECODE_ADC,
	DECODE_DAC,
	DECODE_COUNTER,
	DECODE_LD

}PORT_FUNCTION;

typedef enum
{
	DECODE_ACTION_NONE=0,
	DECODE_SET_DIR,
	DECODE_SET_VALUE,
	DECODE_GET_VALUE,
	DECODE_PAUSE,
	
}PORT_ACTION;

typedef struct _platform_decode_config_
{
	unsigned char dir;
	unsigned char port_num;
	unsigned char pin_num;
	unsigned char pin_func;
	unsigned char pin_action;
	unsigned char pwm_port;
	unsigned char pwm_channel;
	unsigned char adc_port;
	unsigned char adc_channel;
	unsigned char v_index;
	int pin_value;
	
}platform_decode_config;

typedef struct _platform_decode_port_map_
{
	unsigned char port_num;
	unsigned char pin_num;
	unsigned char pwm_port;
	unsigned char pwm_channel;
	unsigned char adc_port;
	unsigned char adc_channel;
}platform_decode_port_map;


typedef struct _platform_decode_adc_map_
{
	unsigned char v_index;
	
}platform_decode_adc_map;

typedef struct _platform_decode_command_index_
{
	unsigned char b_use;
	unsigned int c_index;
	char c_string[DECODE_MAX_STATEMENT_LENGTH];
}platform_decode_command_index;




























#endif